namespace MyIRC
{
	/// <summary>
	/// Connection to irc server
	/// Irc client class which represents connected client to server.
	/// Has ability to join channels, open private chats, etc.
	/// </summary>
	public interface IConnection
	{
		/// <summary>
		/// Connects to specified server. If is connected then disconnects and
		/// connects to given server.
		/// </summary>
		/// <param name="name">server address ex.: irc.dalnet.lt</param>
		/// <param name="port">server port ex.: 6667</param>
		void Connect(string name, int port);

		/// <summary>
		/// Disconnects from server.
		/// Then disconnected Disconnected event raised
		/// </summary>
		void Disconnect();

		/// <summary>
		/// Disconnects from server. Waits until clinet thread is stopped.
		/// </summary>
		/// <param name="message">Quit message</param>
		void Disconnect(string message);

		/// <summary>
		/// Sends message to the connected server
		/// </summary>
		/// <param name="message">Message to send</param>
		void SendMessage(string message);

		/// <summary>
		/// Gets user configuration
		/// </summary>
		IUser User
		{
			get;
		}

		/// <summary>
		/// Joins specified channel. On successfull join JoinedChannel event is trigered and sended object of IChannel implementation.
		/// </summary>
		/// <param name="name">Channel name</param>
		void JoinChannel(string name, string key);

		/// <summary>
		/// Opens private chat.  On successfull query nick NewPrivateChat event is trigered and sended object of IPrivate implementation.
		/// </summary>
		/// <param name="nick">Nick to talk to</param>
		void QueryNick(string nick);

	//	/// <summary>
	//	/// Searches channel list for given channel. If channel found returns reference to it overwise returns null.
	//	/// </summary>
	//	/// <param name="channelName">channel name to find</param>
	//	/// <returns>reference to channel if found overwise null</returns>
	//	IChannel FindChannel(string channelName);

		/// <summary>
		/// Are we still connected to server
		/// </summary>
		bool IsConnected
		{
			get;
		}

		bool CreatePrivatesForNotice
		{
			get;
			set;
		}



		/// <summary>
		/// Then new private chat opened
		/// </summary>

		/// <summary>
		/// Then disconnected from server
		/// </summary>

		/// <summary>
		/// Then connected to server
		/// </summary>


		/// <summary>
		/// Then nick changed
		/// </summary>

		/// <summary>
		/// Delegate called then notice recieved
		/// </summary>

		/// <summary>
		/// Event then user joins jannel
		/// </summary>

//		event NewPrivateMsgHandler NewPrivateMsg;
//		event NickChangedHandler NickChanged;
		
		
		
		event EventHandlerRawMessage RawMessageRecieved;
		event EventHandlerConnected Connected;
		/// <summary>
		/// Ping Pong event
		/// </summary>
		event EventHandlerPingPong PingPong;
		event EventHandlerDisconnected Disconnected;
		event EventHandlerUnparsedLeftText UnparsedLeftText;
		event EventHandlerChannelJoined ChannelJoined;
		event EventHandlerPrivateChatCreated PrivateChatCreated;
		event EventHandlerNotice Notice;
	}
}
